<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Superpixel Benchmark: Building</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Superpixel Benchmark
   </div>
   <div id="projectbrief">Superpixel benchmark, tools and algorithms.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">Building </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>For getting started quickly:</p>
<ul>
<li>[#Quick Start](quick-start)</li>
</ul>
<p>For details, there are three main components that need to be built:</p>
<ul>
<li><a href="#c++">C++ Components</a><ul>
<li><a href="#prerequisites">Prerequisites</a></li>
<li><a href="#building-options">Building Options</a></li>
<li><a href="#prerequisites-for-individual-algorithms">Prerequisites for Individual Algorithms</a><ul>
<li><a href="#cis">CIS</a></li>
<li><a href="#dasp">DASP</a></li>
<li><a href="#ergc">ERGC</a></li>
<li><a href="#vlslic">vlSLIC</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#matlab">MatLab Components</a></li>
<li><a href="#java">Java Components (PF)</a></li>
</ul>
<h2>Getting Started</h2>
<p>The following quick start was tested on Ubuntu 12.04 and Ubuntu 14.04. Make sure to clone the repository recursively, then execute: </p><pre class="fragment">$ git clone https://github.com/davidstutz/superpixel-benchmark --recursive
$ sudo apt-get install build-essential cmake libboost-dev-all libopencv-dev cimg-dev cimg-doc cimg-examples libpng-dev libpng++-dev
# Alternatively download GLog 0.3.3 to avoid the hard reset!
$ git clone https://github.com/davidstutz/glog
$ cd glog
$ git reset --hard 0b0b022
$ ./configure
$ make
$ cd ..
$ cd superpixel-benchmark
$ mkdir build
$ cd build
# Better install GLog properly and adapt cmake/FindGlog.cmake!
$ cmake .. -DGLOG_ROOT_DIR=~/glog
$ make
</pre><p>Installs <a href="https://cmake.org/">Cmake</a>, <a href="http://www.boost.org/">Boost</a>, <a href="http://opencv.org/">OpenCV</a>, <a href="https://github.com/google/glog">GLog</a>, <code>libpng</code>, <code>libpng++</code> and <a href="http://cimg.eu/">CImg</a>. This builts the seven recommended algorithms as discussed in the paper as well as the benchmark and tools.</p>
<p>Also see <code>.travis.yml</code> for details on building on a fresh Ubuntu 14.04 installation!</p>
<h2>C++</h2>
<p>Building the C++ components is done using <a href="https://cmake.org/">CMake</a> and all of them are based on the <code>lib_eval</code> component which holds the benchmark as well as toopls.</p>
<h3>Prerequisites</h3>
<p>A C++ compiler supporting C++11 is assumed to be available. It was tested with gcc &gt;= 4.8.4. Building has been tested with Ubuntu 12.04 and Ubuntu 14.04.</p>
<p>All algorithms depend on the tools in <code>lib_eval</code>. Requirements are:</p>
<ul>
<li><a href="https://cmake.org/">CMake</a>,</li>
<li><a href="http://www.boost.org/">OpenCV</a></li>
<li><a href="https://github.com/google/glog">Boost</a></li>
<li><a href="https://github.com/google/glog">GLog</a>.</li>
</ul>
<p>Additionally, the algorithms built by default depend on:</p>
<ul>
<li><a href="http://www.libpng.org/pub/png/libpng.html">PNG</a></li>
<li><a href="http://www.nongnu.org/pngpp/">PNG++</a></li>
</ul>
<p>Note that the required CMake modules, e.g. for finding GLog, can be found in <code>cmake</code> in case these need to be adapted.</p>
<p>CMake, OpenCV and Boost can be installed as follows: </p><pre class="fragment">$ sudo apt-get install build-essential cmake libboost-dev-all libopencv-dev
</pre><p>OpenCV can alternatively be installed following <a href="http://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation">these instructions</a>. Currently, OpenCV 2.4.11 is supported, in general 2.4.x should work fine. For upgrading to OpenCV 3.0 and OpenCV 3.1, it might be necessary to update constants (e.g. as used for color conversion). Some implementations are known to work with OpenCV 3 and OpenCV 3.1 (e.g. reSEEDS).</p>
<p>GLog 0.3.3 should be installed manually. GLog should be downloaded or cloned from <a href="https://github.com/google/glog">google/glog</a>. If the repository is cloned, make sure to checkout version 0.3.3. Then: </p><pre class="fragment">$ cd glog-0.3.3/
$ ./configure
$ make
$ sudo make install
</pre><p>For further instructions see the issue tracker at <a href="https://github.com/google/glog">google/glog</a>.</p>
<p>Note that GLog can alternatively be installed using </p><pre class="fragment">$ sudo apt-get install libgoogle-glog-dev
</pre><p>However, <code>cmake/FindGlog.cmake</code> needs to be adapted and some parts might not working with newer versions.</p>
<p>For installing PNG and PNG++: </p><pre class="fragment">sudo apt-get install libpng-dev # should already be installed for OpenCV
sudo apt-get install libpng++-dev
</pre><p>As reference, these are the library versions as installed on Ubuntu 14.04 (checked using <code>dpkg -l</code>) where OpenCV and GLog where installed manually: </p><pre class="fragment">||/ Name                Version        Architecture  
+++-===================-==============-==============
ii  gcc                 4:4.8.2-1ubunt amd64
ii  cmake               3.2.2-2ubuntu2 amd64
ii  libboost-dev        1.54.0.1ubuntu amd64
ii  libpng12-dev        1.2.50-1ubuntu amd64
ii  libpng++-dev        0.2.5-1        all
</pre><h3>Building Options</h3>
<p>After verifying that the requirements are met: </p><pre class="fragment">$ mkdir build
$ cd build
$ cmake ..
$ cmake -LAH
</pre><p>This will list all available CMake options. These options include:</p>
<ul>
<li><code>-DBUILD_CCS</code>: build CCS (Off)</li>
<li><code>-DBUILD_CIS</code>: build CIS (Off), follow <a class="el" href="BUILDING__CIS_8md.html">building CIS</a> for details</li>
<li><code>-DBUILD_CRS</code>: build CRS (On)</li>
<li><code>-DBUILD_CW</code>: build CW (Off)</li>
<li><code>-DBUILD_DASP</code>: build DASP (Off)</li>
<li><code>-DBUILD_ERGC</code>: build ERGC (On)</li>
<li><code>-DBUILD_ERS</code>: build ERS (On)</li>
<li><code>-DBUILD_ETPS</code>: build ETPS (On)</li>
<li><code>-DBUILD_FH</code>: build FH (Off)</li>
<li><code>-DBUILD_EXAMPLES</code>: build examples (Off)</li>
<li><code>-DBUILD_LSC</code>: build LSC (Off)</li>
<li><code>-DBUILD_MSS</code>: build MSS (Off)</li>
<li><code>-DBUILD_PB</code>: build PB (On)</li>
<li><code>-DBUILD_PRESLIC</code>: build SLIC (Off)</li>
<li><code>-DBUILD_REFH</code>: build reFH (Off)</li>
<li><code>-DBUILD_RESEEDS</code>: build reSEEDS (On)</li>
<li><code>-DBUILD_SEEDS</code>: build SEEDS (On)</li>
<li><code>-DBUILD_SLIC</code>: build SLIC (On)</li>
<li><code>-DBUILD_VC</code>: build VC (Off)</li>
<li><code>-DBUILD_VCCS</code>: build VCCS (Off)</li>
<li><code>-DBUILD_VLSLIC</code>: build vlSLIC (Off)</li>
<li><code>-DBUILD_W</code>: build W (Off)</li>
</ul>
<p>Note that the algorithms recommended in the paper are built by default. To change this, use the options indicated above or edit <code>CMakeLists.txt</code> accordingly.</p>
<h3>Prerequisites for Individual Algorithms</h3>
<p>In the following, we outline additional prerequisites needed to build selected superpixel algorithms. Note that when using the default options, no additional requirements need to be fulfilled.</p>
<h4>CIS</h4>
<p>The CIS source code is not directly included in this repository due to license constraints. For installing and building CIS, follow <a class="el" href="BUILDING__CIS_8md.html">these instructions</a>.</p>
<h4>DASP</h4>
<p><a href="http://eigen.tuxfamily.org/index.php?title=Main_Page">Eigen3</a> is required: </p><pre class="fragment">sudo apt-get install libeigen3-dev
</pre><p>For reference, the following version was installed on Ubuntu 14.04: </p><pre class="fragment">||/ Name                Version        Architecture
+++-===================-==============-==============
ii  libeigen3-dev       3.2.0-8        all
</pre><h4>ERGC</h4>
<p><a href="http://cimg.eu/">CImg</a> and <a href="http://www.netlib.org/lapack/">LAPACK</a> is required: </p><pre class="fragment">sudo apt-get install cimg-dev cimg-doc cimg-examples
</pre><p>For reference, the following version was installed on Ubuntu 14.04: </p><pre class="fragment">||/ Name                Version        Architecture
+++-===================-==============-==============
ii  cimg-dev            1.5.7+dfsg-1   all
</pre><h4>vlSLIC</h4>
<p>Note that the source code in <code>lib_vlslic</code> is part of the <a href="http://www.vlfeat.org/">VLFeat</a> library. The library was stripped to the essentials components needed for vlSLIC. Alternatively, VLFeat can be installed as described <a href="http://www.vlfeat.org/compiling-unix.html">here</a>. The corresponding <code>CMakeLists.txt</code> in <code>vlslic_cli</code> and <code>lib_vlslic</code> may need to be adapted (note that <code><a class="el" href="vlslic__opencv_8h.html">lib_vlslic/vlslic_opencv.h</a></code> is header only such that <code>lib_vlslic</code> might not be required to be compiled.</p>
<h2>MatLab</h2>
<p>Some MatLab sources are based on C++ components. In order to compile and MEX these components, <code>make.m</code> can be used. It provides the following variables: </p><pre class="fragment">BUILD_TOOLS = 1;
BUILD_EAMS = 0;
BUILD_NC = 0;
BUILD_QS = 0;
BUILD_SEAW = 0;
BUILD_TP = 0;
BUILT_TPS = 0;
</pre><p>These can be used to compile individual algorithms. Alternatively, the corresponding <code>make.m</code> files can be run directly, i.e. <code>lib_tools/make.m</code>, <code>lib_eams/make.m</code>, <code>lib_nc/make.m</code>, <code>lib_qs/make.m</code>, <code>lib_seaw/make.m</code>, <code>lib_tp/make.m</code> and <code>lib_tps/make.m</code>.</p>
<p>Compiling was tested with MatLab R2015b and gcc &gt;=4.8.4. Note however, that later MatLab version have different requirements regarding the compiler. For example, in MatLab R2015b, gcc 4.8.4 is not officially supported (still it works in this case).</p>
<h2>Java</h2>
<p>Only PF is written in Java. For compiling the Java source, follow <code>lib_pf/make.sh</code>: </p><pre class="fragment">$JAVAC *.java
$JAR cfm PathFinder.jar Manifest.txt *.java *.class
$JAVA -jar PathFinder.jar
</pre><p>Make sure to set the variables <code>JAVAC</code>, <code>JAR</code> and <code>JAVA</code> correctly. On Ubuntu 14.04, this may look as follows: </p><pre class="fragment">JAVAC="/home/david/jdk1.8.0_45/bin/javac"
JAR="/home/david/jdk1.8.0_45/bin/jar"
JAVA="/home/david/jdk1.8.0_45/bin/java" </pre> </div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Apr 16 2017 16:39:17 for Superpixel Benchmark by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
